package com.yangguang.huahui.mvp.presenter;

import com.yangguang.huahui.entity.ChatMessage;
import com.yangguang.huahui.mvp.model.NewsModel;
import com.yangguang.huahui.mvp.view.ChatMessageView;
import com.yangguang.huahui.rx.RxManager;
import com.yangguang.huahui.rx.RxSubscriber;

import retrofit2.http.PUT;

/**
 * Created by Administrator on 2017/3/15.
 */

public class ChatMessagePresenter extends BasePresenter<ChatMessageView>{
    NewsModel model;

    public ChatMessagePresenter() {
        model = new NewsModel();
    }
    public void getMsgList(String uid){
        mSubscription = RxManager.getInstance().doSubscribe(model.getChatList(uid), new RxSubscriber<ChatMessage>(false) {
            @Override
            protected void _onNext(ChatMessage chatMessage) {
                try {
                    mView.onSuccess(chatMessage);
                }catch (Exception e){
                    e.printStackTrace();
                }
            }

            @Override
            protected void _onError() {
                mView.onError();
            }
        });
    }
}
